package com.azxc.rapid.plus.user.vo;

import com.azxc.rapid.core.tool.node.INode;
import com.azxc.rapid.system.entity.Dept;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.List;

/**
 * 视图实体类
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "UserTreeVO对象", description = "UserTreeVO对象")
public class UserTreeVO extends Dept implements INode<UserTreeVO> {

  private static final long serialVersionUID = 1L;

  /**
   * 主键ID
   */
  @JsonSerialize(using = ToStringSerializer.class)
  private Long id;

  /**
   * 父节点ID
   */
  @JsonSerialize(using = ToStringSerializer.class)
  private Long parentId;

  @JsonSerialize(using = ToStringSerializer.class)
  private String nodeType;

  /**
   * 子孙节点
   */
  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  private List<UserTreeVO> children;




  /**
   * 是否有子孙节点
   */
  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  private Boolean hasChildren;

  @Override
  public List<UserTreeVO> getChildren() {
    if (this.children == null) {
      this.children = new ArrayList<>();
    }
    return this.children;
  }

  /**
   * 上级机构
   */
  private String parentName;

  /**
   * 机构类型名称
   */
  private String deptCategoryName;

  private String name;

  private String duty;

  private String value;

  private String phone;

  private String key;

  private Boolean disabled;

  private String roleId;
}
